package com.inspur.gs.sbssdl.sbwhgl.sbrh.sbrh.back.sbsssbrhbz.validations;
import com.inspur.edp.bef.api.lcp.IStandardLcp;
import com.inspur.edp.caf.db.dbaccess.IDbParameter;
import com.inspur.edp.cef.api.message.*;
import com.inspur.edp.bef.api.action.validation.*;
import com.inspur.edp.bef.spi.action.validation.*;
import com.inspur.edp.cef.entity.changeset.*;
import com.inspur.edp.bef.spi.action.validation.AbstractValidation;
import com.inspur.edp.bef.api.action.validation.IValidationContext;
import com.inspur.edp.cef.entity.entity.IEntityData;
import com.inspur.edp.qdp.bql.api.IBqlExecuter;
import io.iec.edp.caf.runtime.config.BqlBeanUtil;

import java.util.ArrayList;
import java.util.List;

public class sbssSbrhBzItemDeletingVals1MgrAction extends AbstractValidation {
	public sbssSbrhBzItemDeletingVals1MgrAction(IValidationContext context, IChangeDetail change) {
		super(context,change);
	}

	private final IBqlExecuter bqlExecuter = BqlBeanUtil.getAppCtx().getBean(IBqlExecuter.class);
	private String enId = "8d822d8f-d398-499e-b621-f27776e66614";
	private String sql = "delete from sbssSbrhMx.sbssSbrhMx where lustand = @standId";
	private final List<IDbParameter> params = new ArrayList<>();
	/**
	 * 删除计划中中的明细
	 */
	@Override
	public  void execute() {
		String id = getContext().getOriginalData().getID();

		List<String> entityIds = new ArrayList<>();
		entityIds.add(enId);

		params.add(bqlExecuter.makeInParam("standId", id));

		bqlExecuter.executeBqlStatement(sql,entityIds,params.toArray(new IDbParameter[0]));

	}
	private IEntityData getData() {
		return (IEntityData)super.getContext().getCurrentData();
	}
}